import {
  Controller,
  Get,
  Post,
  Put,
  Body,
  Query,
  UseGuards,
  Headers,
  Delete,
  Param,
} from '@nestjs/common';
import {
  ApiBearerAuth,
  ApiOperation,
  ApiResponse,
  ApiParam,
  ApiQuery,
  ApiTags,
} from '@nestjs/swagger';
import { AuthGuard } from '@nestjs/passport';

import LocalesService from './service';

import { CreateBlogDto } from './dto';

@ApiTags('locales')
@Controller('/locales')
export default class LocalesController {
  constructor(private readonly service: LocalesService) {}

  // @UseGuards(AuthGuard())
  @ApiOperation({
    summary: '新建某个页面的国际化配置',
  })
  @ApiBearerAuth()
  @Put('/create')
  async create(@Body() createBlog: CreateBlogDto) {
    return this.service.create();
  }

  // @UseGuards(AuthGuard())
  @ApiOperation({
    summary: '更新某个页面的国际化配置',
  })
  @ApiParam({
    name: 'id',
    description: '页面id',
  })
  @ApiBearerAuth()
  @Post('/update/:id')
  async update(@Param('id') id: string, @Body() createBlog: CreateBlogDto) {
    return this.service.create();
  }

  // @UseGuards(AuthGuard())
  @ApiOperation({
    summary: '页面的国际化配置分页',
  })
  @ApiQuery({
    name: 'page',
    description: '当前页',
    required: false,
  })
  @ApiQuery({
    name: 'pageSize',
    description: '每页多少条',
    required: false,
  })
  @ApiBearerAuth()
  @Get('/list')
  async list(@Query('page') page: number, @Query('pageSize') pageSize: number) {
    return this.service.create();
  }

  @ApiOperation({
    summary: '查询某个页面的国际化配置详情',
  })
  @ApiParam({
    name: 'enum',
    description: '页面enum',
  })
  @ApiBearerAuth()
  @Get('/detail/:id')
  async detail(@Param('id') id: string) {
    return this.service.create();
  }
}
